package com.vhly.ddxdecompiler.dexreader;

import com.vhly.ddxdecompiler.dexreader.file.DexFile;
import com.vhly.ddxdecompiler.dexreader.io.DexInputStream;
import com.vhly.ddxdecompiler.dexreader.util.StreamUtil;

import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

/**
 * Created by IntelliJ IDEA.
 * User: vhly
 * Date: 2009-10-14
 * Time: 17:08:37
 *
 * @author vhly[FR]
 */
public final class DexReader {

    public static DexFile parse(InputStream in) {
        DexFile ret = null;
        DataInputStream din = null;
        DexInputStream dex = null;
        try {
            din = new DataInputStream(in);
            dex = new DexInputStream(din, 1);
            ret = new DexFile();
            ret.read(dex);
            System.out.println("dexFile read finish");
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            StreamUtil.close(dex);
            StreamUtil.close(din);
        }
        return ret;
    }
}
